//
//  ModuleViewController.m
//  CocoaSynth
//
//  Created by Thomas Dupont on 19/02/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "ModuleViewController.h"

#import "Module.h"
#import "MixingViewController.h"
#import "PortInViewController.h"
#import "PortOutViewController.h"
#import "PortViewController.h"
#import "ParametersModule.h"

@implementation ModuleViewController

@synthesize model;
@synthesize name;
@synthesize portsIn;
@synthesize portsOut;

- (id)init
{
	if (self = [super init]) {
		portsIn = [[NSMutableSet alloc] init];
		portsOut = [[NSMutableSet alloc] init];
	}
	return self;
}

- (void)dealloc
{
	self.model = nil;
	self.name = nil;
	[portsIn release];
	[portsOut release];
	[super dealloc];
}

- (void)setMixingController:(MixingViewController*)theController
{
	mixingController = theController;
}

#pragma mark -
#pragma mark Ports Selection

- (void)selectPortIn:(PortInViewController*)aPort
{
	[mixingController selectPortIn:aPort];
}

- (void)selectPortOut:(PortOutViewController*)aPort
{
	[mixingController selectPortOut:aPort];
}

- (void)unselectPorts
{
	[mixingController unselectPorts];
}

- (void)disconnectPort:(PortViewController*)aPort
{
	[mixingController disconnectPort:aPort];
}

- (void)refresh
{
	[mixingController refresh];
}

- (void)displayParameterView
{
	
}

- (NSViewController<ParametersModule>*)parameters
{
	return nil;
}

- (void)bringModuleToFront
{
	[mixingController bringSubviewToFront:self.view];
}

- (void)deleteModule
{
	[mixingController removeModule:self];
}

- (void)highlight
{
	
}

- (void)unhighlight
{
	
}

@end
